<%--
  Created by IntelliJ IDEA.
  User: chenr
  Date: 7/15/2019
  Time: 4:26 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta name='TTUNION_verify' content='b846c3c2b85efabc496d2a2b8399cd62'>
    <meta name="sogou_site_verification" content="gI1bINaJcL"/>
    <meta name="360-site-verification" content="37ae9186443cc6e270d8a52943cd3c5a" />
    <meta name="baidu_union_verify" content="99203948fbfbb64534dbe0f030cbe817">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="apple-touch-fullscreen" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <meta name="keywords" content="js特效">
    <meta name="description" content="js特效。">
    <title>登录页面</title>
    <link rel="stylesheet" type="text/css" href="/static/css/base.css">
    <link rel="stylesheet" type="text/css" href="/static/css/home.css">
</head>
<body>

<header class="aui-header">
    <div class="aui-header-box">
        <h1>
            <a href="login" class="aui-header-box-logo"></a>
        </h1>
    </div>
</header>

<section class="aui-content">
    <div class="aui-content-box clearfix">
        <div class="aui-content-box-fl">
            <div class="aui-form-header">
                <div class="aui-form-header-item on">密码登录</div>
                <div class="aui-form-header-item">账号注册</div>
                <span class="aui-form-header-san"></span>
            </div>
            <div class="aui-form-content">
                <div class="aui-form-content-item">
                    <form action="login" method="post">
                        <div class="aui-form-list">
                            <input type="text" class="aui-input" name="aname" placeholder="请输入手机号/邮箱" data-required="required" autocomplete="off">
                        </div>
                        <div class="aui-form-list">
                            <input type="password" class="aui-input" name="password" placeholder="请输入密码" data-required="required" autocomplete="off">
                        </div>
                        <!--<div class="aui-form-pwd clearfix">-->
                        <!--<a href="#">忘记密码？</a>-->
                        <!--</div>-->
                        <div class="aui-form-btn">
                            <input type="submit" class="aui-btn" value="登&nbsp;录" >
                        </div>
                    </form>
                </div>
                <div class="aui-form-content-item">

                    <div class="aui-form-list">
                        <input type="text" class="aui-input" id="newaname" placeholder="请输入用户名" data-required="required" autocomplete="off">
                    </div>
                    <div class="aui-form-list">
                        <input type="password" class="aui-input" id="newpassword" placeholder="请输入密码" data-required="required" autocomplete="off">
                    </div>
                    <div class="aui-form-btn">
                        <input type="submit" class="aui-btn" value="注&nbsp;册" id="login-btn">
                    </div>

                </div>
            </div>
        </div>
        <div class="aui-content-box-fr">
            <img src="/static/images/plane.jpg" width="250" height="189" >
        </div>
    </div>
</section>

<script type="text/javascript" src="/static/js/jquery-3.3.1.js"></script>
<script type="text/javascript">
    $(function(){

        /*tab标签切换*/
        function tabs(tabTit,on,tabCon){
            $(tabCon).each(function(){
                $(this).children().eq(0).show();

            });
            $(tabTit).each(function(){
                $(this).children().eq(0).addClass(on);
            });
            $(tabTit).children().click(function(){
                $(this).addClass(on).siblings().removeClass(on);
                var index = $(tabTit).children().index(this);
                $(tabCon).children().eq(index).show().siblings().hide();
            });
        }
        tabs(".aui-form-header","on",".aui-form-content");

    })

    $("#login-btn").click(function(){
        var pwd=$("#newpassword").val();
        var account=$("#newaname").val();
        if(pwd==null||account==null) {
            alert("请正确输入！");
        }
        else{
            $.post("/admin/register",{ account: account, password:pwd },function(data){
                if(data.State=="true"){
                    alert("注册成功！")
                    $(location).attr('href', '/admin/login');
                }
                else{
                    alert("注册失败！"+data.message);
                }
            })
        }
    })
</script>

</body>
</html>
